<?php
/**
 * User:ayou chow
 * Date: 2020-02-05
 * Time: 14:45
 */

namespace app\common\model;


use think\Model;

class StatisticsModel extends Model
{

    /**
     * 注册用户自增长
     * @return bool|int|string
     * @throws \think\Exception
     */
    static public function setRegistPcNum()
    {
        $date = date('Ymd');
        $info = self::where('id', $date)->find();
        if ($info) {
            return self::where('id', $date)->setInc('regist_pc');
        }
        // 不存在插入数据
        $param = [
            'id'        => $date,
            'regist_pc' => 1,
            'time'      => date('Y-m-d H:i:s')
        ];
        return self::insert($param);
    }

}